<div class="message" id="message_<%= message.id %>">  
  <div class="message_title">
    <% if message.recipient == current_user.id %>
      <% if message.read %>
        <%= image_tag("read.png", :style => 'float: left;') %>
      <% else %>
        <%= image_tag("mail.png", :style => 'float: left;') %>
      <% end %>
    <% else %>
      <%= image_tag("message_new.png", :style => 'float: left;') %>
    <% end %>
    <%= message.title %> (od: <%= User.find(message.sender).email %>)
  </div>
  <div class="date">    
    <%= l message.created_at.to_datetime %>
  </div>
  <%= link_to_function("pokaż / schowaj", nil, :id => "more_link") do |page|
   page[("message_body_" + message.id.to_s)].toggle "Blind"   
   end  %>
  <div style="display: none; min-height: 40px;" class="message_body" id="message_body_<%= message.id %>">
    <%= message.body %>
    <%= link_to_remote image_tag("usun.png", :style => "float: right;"),
      :url => { :controller => 'messages', :action => "destroy", :id => message.id } %>
  </div>
  <% if !message.read && message.recipient == current_user.id %>
    <%= link_to_remote("Oznacz jako przeczytaną", :url => { :controller => "messages",
      :action => "mark_as_read" , :id => message.id }, :style => 'font-size: 0.7em') %>
  <% end %>
</div>